package com.jk.garden1.controller;

import com.jk.garden1.entity.StaffEntity;
import com.jk.garden1.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 员工信息
 */
@RestController
@RequestMapping("staff")
public class StaffController {
    @Autowired
    private StaffService staffService;
    /**
     * 查询全部
     */
    @RequestMapping("selectStaffList")
    public List<StaffEntity> selectStaffList(){
        return staffService.selectStaffList();
    }
    /**
     * 添加员工
     */
    @RequestMapping("addStaff")
    public void addStaff(StaffEntity staffEntity){
        staffService.addStaff(staffEntity);
    }

    /**
     * 注销
     */
    @RequestMapping("updateById")
    public void updateById(Integer id){
        staffService.updateById(id);
    }
    /**
     * 删除
     */
    @RequestMapping("delById")
    public void delById(Integer id){
        staffService.delById(id);
    }


    /**
     * es高亮
     * @param staff
     * @return
     */
    @RequestMapping("queryEsList")
    public Object queryEsList(StaffEntity staff){
        return staffService.queryEsList(staff);
    }

    /**
     * 查询员工
     */
    @RequestMapping("selectname")
    public Object selectname(String name){
        return staffService.selectname(name);
    }
}
